package ch.fusun.baron.swt.isometry.components;

/**
 * A point in 3d
 */
public class Point3D {
	private final int x;
	private final int y;
	private final int z;

	/**
	 * @param x
	 *            The x position
	 * @param y
	 *            The y position
	 * @param z
	 *            The z position
	 */
	public Point3D(int x, int y, int z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Point3D) {
			Point3D other = (Point3D) obj;
			return other.x() == this.x() && other.y() == this.y()
					&& other.z() == this.z();
		}
		return false;
	}

	int z() {
		return this.z;
	}

	int y() {
		return this.y;
	}

	int x() {
		return this.x;
	}

	@Override
	public int hashCode() {
		return this.x() + this.y() + this.z();
	}

	@Override
	public String toString() {
		return "x: " + this.x + " y: " + this.y + " z: " + z; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	}
}
